﻿@{
    ViewBag.Title = "开始排课";
    Layout = "~/Views/Shared/___newestMaster.cshtml";
}


@section style {
    <style type="text/css">
        .donwloadLinks a {
            color: #007061;
            font-size: 17px;
            text-decoration: none;
        }

        .adjustment {
            margin-left: -60px;
        }
    </style>
}

<div class="kspk" style="">
    <div class="bigimg">
        <div class="conConTo2 col-lg-12 col-md-12 col-sm-12">
            <ul>
                <li>快完成啦</li>
                <li>
                    <p style="text-align: left;">温馨提示</p>
                    <p id="sec">剩下的工作交给华志创云排课把~</p>
                    <div class="donwloadLinks"></div>
                </li>

            </ul>
        </div>
        <img src="/static/newestHTML/assets/css/images/index2/img2412.png" alt="">
        <input type="button" name="" id="beginClass" data-taskid="@(ViewBag.taskid)" value="开始自动排课">
        <input class="col-lg-2 col-md-4 col-sm-3" type="button" onclick="window.history.go(-1)" name="" id="" value="上一步">
    </div>
    <div class="vbig">
    </div>
</div>

<input type="hidden" id="extension" value="@(ViewBag.extensionName)" />

@section script {
    <script type="text/javascript">
        $("#beginClass").on("click", function () {
            //$(".modal-body").find("h2").text("排课任务正在进行中....请稍后....");
            var $this = $(this);
            //$this.attr("data-target", "#sheduleModal");
            var taskid = $this.attr("data-taskid");
            $.get("CreateDataTxt", {
                taskid: taskid, extension: $("#extension").val()
            }, function (data) {
                if (data.status) {
                    //$(".modal-body").find("h2").text("排课任务排课完毕!");
                    //$(".modal-footer").find("button").show();
                    // 显示下载的txt文件链接
                    var $html = "";
                    for (var i = 0; i < data.downloadList.length; i++) {
                        var link = data.downloadList[i];
                        var fileName = link.substring(link.lastIndexOf('/') + 1);
                        $html += "<a href='" + link + "' target='_blank'>" + fileName + "</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

                        $(".donwloadLinks").html($html);
                        if (!$("#sec").hasClass("adjustment")) { $("#sec").addClass("adjustment"); }
                    }
                    showSuccess("排课成功!");
                }
            })
        })

    </script>
}